<html>
<head><meta charset="utf-8"><title>panic_context · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html">panic_context</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="214311358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214311358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214311358">(Oct 23 2020 at 13:14)</a>:</h4>
<p>I was looking for examples of <code>panic_context</code> usage and found <a href="https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L37">https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L37</a> and <a href="https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L163">https://github.com/rust-analyzer/rust-analyzer/blob/81609960fa30ea92e37b23dc7b025d1939626812/crates/rust-analyzer/src/dispatch.rs#L163</a>. Aren't these dropping the context immediately again?</p>



<a name="214311635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214311635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214311635">(Oct 23 2020 at 13:16)</a>:</h4>
<p>Oups, good catch.</p>



<a name="214311662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214311662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214311662">(Oct 23 2020 at 13:16)</a>:</h4>
<p>I definitelly tried this out and saw it working</p>



<a name="214311672"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214311672" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214311672">(Oct 23 2020 at 13:16)</a>:</h4>
<p>So maybe I was running different code?</p>



<a name="214311702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214311702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214311702">(Oct 23 2020 at 13:16)</a>:</h4>
<p>there's one in between that holds on to it</p>



<a name="214312014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214312014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214312014">(Oct 23 2020 at 13:19)</a>:</h4>
<p>What a beautiful footgun: I've annotated <code>PanicContext</code> with <code>#[must_use]</code>, but was returning it as <code>impl Drop</code></p>



<a name="214312124"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/panic_context/near/214312124" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/panic_context.html#214312124">(Oct 23 2020 at 13:20)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/issues/6335">#6335</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>